package cn.com.lms.business.exam.persistence.entity;

import com.bnzj.core.json.DateDeserializer;
import com.bnzj.core.util.FbConstant;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;

@Entity
@Getter
@Setter
@Table(name = "bnz_exam_employee_paper_subject")
@Schema(description = "用户试卷答题")
public class EmployeePaperSubject {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Schema(description = "唯一标识")
    protected Long id;// 主键

    @Schema(name = "答卷ID")
    @Column(name = "employee_paper_id")
    private Long employeePaperId;


    @Schema(name = "试题ID")
    @Column(name = "subject_id")
    private Long subjectId;
    @Schema(description = "题型 1-单选题 2-多选题 3判断题 4填空题 5问答题")
    private Short type;

    @Schema(description = "题目")
    private String subject;

    @Schema(description = "题目选项")
    private String options;

    @Schema(description = "题目图片")
    private String images;

    @Schema(description = "正确答案")
    @Column(name = "right_answer")
    private String rightAnswer;

    @Schema(description = "答案解析")
    private String parse;

    @Schema(name = "题目分数")
    @Column(name = "subject_score")
    private Integer subjectScore;


    @Schema(name = "排序号")
    @Column(name = "sort_id")
    private Long sortId;


    @Schema(name = "员工ID")
    @Column(name = "employee_id")
    private Long employeeId;

    @Schema(name = "用户答案")
    @Column(name = "answer")
    private String answer;

    @Schema(name = "用户得分")
    private Integer score;


    @Column(name = "create_time")
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(pattern = FbConstant.DATETIME_FORMAT)
    @JsonDeserialize(using = DateDeserializer.class)
    @JsonFormat(pattern = FbConstant.DATETIME_FORMAT, timezone = "GMT+8")
    @Schema(description = "创建时间")
    private Date createTime;// 创建时间

    @Column(name = "modify_time")
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(pattern = FbConstant.DATETIME_FORMAT)
    @JsonDeserialize(using = DateDeserializer.class)
    @JsonFormat(pattern = FbConstant.DATETIME_FORMAT, timezone = "GMT+8")
    @Schema(description = "修改时间")
    private Date modifyTime;// 修改时间


}
